module.exports = function (grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        concat: {
            options: {
                separator: ';'
            },
            js : {
                src: [
                    '../development/js/colorpicker.js',
                    '../development/js/zixys.*.js',
                    '../development/js/zixys.js'
                ],
                dest: '../development/min/temp/<%= pkg.name %>.js'
            },
            css : {
                options : {
                    banner : "var zixysStyle ='",
                    footer : "';",
                    process: function(src, filepath) {
                        return src.replace(/url\(images/g, 'url(http://zixys.com/src/images');
                    }
                },
                src: ['../development/min/temp/<%= pkg.name %>.min.css'],
                dest: '../development/min/<%= pkg.name %>.mincss.js'
            }
        },
        uglify: {
            zixysSources : {
                options : {
                    banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */ (function($,angular){ \n',
                    footer : '})(jQuery,angular);'
                },
                files: {
                    '../development/min/<%= pkg.name %>.min.js': ['<%= concat.js.dest %>']
                }
            }
        },
        min: {
            'zixysInstall': {
                'src': ['../development/zixys.install.js'],
                'dest': '../deploy/zixys-install.min.js'
            }
        },

        cssmin : {
            css : {
                files: {
                    '../development/min/temp/<%= pkg.name %>.min.css': ['../development/css/style_grey.css']
                }
            }
        },
        copy: {
            deployed: {
                files: [
                    {
                        flatten: true,
                        expand : true,
                        src: ['../development/min/*'],
                        filter: 'isFile',
                        dest: '../deploy/'
                    }
                ]
            },
            images: {
                files: [
                    {
                        flatten: true,
                        expand : true,
                        src: ['../development/css/images/*'],
                        filter: 'isFile',
                        dest: '../deploy/images'
                    }
                ]
            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-aetheon-cssmin');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-yui-compressor');

    grunt.registerTask('default', ['concat:js', 'uglify','min','cssmin','concat:css','copy']);

};